<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="page_containerContainer" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="page_container"
            v-show="store.layoutModelDetails?.page_container?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #container1>
                <slot name="container1Container" :controller="controller" :store="store" :model="model" >
                <AppStandardContainer 
                    name="container1"
                    v-show="store.layoutModelDetails?.container1?.visible"
                    :isMultiContainer="false"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #static_text1>
                        <slot name="static_text1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_text1"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                    <template #field_textbox>
                        <slot name="field_textbox" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPanelField
                            name="field_textbox"
                            :value="store.layoutData.field_textbox"
                            :layoutModelDetails="store.layoutModelDetails">
                            <slot name="field_textboxEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppInput
                                v-bind="{ editorType: 'TEXTBOX', }"
                                type="text"
                                style=""
                                name="field_textbox"
                                :isDebounce="true"
                                :disabled="store.layoutModelDetails.field_textbox?.disabled ? true : false"
                                :value="store.layoutData.field_textbox"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            />
                            </slot>
                        </AppPanelField>
                        </slot>
                    </template>
                    <template #static_text2>
                        <slot name="static_text2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_text2"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                    <template #field_textbox1>
                        <slot name="field_textbox1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPanelField
                            name="field_textbox1"
                            :value="store.layoutData.field_textbox1"
                            :layoutModelDetails="store.layoutModelDetails">
                            <slot name="field_textbox1Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppInput
                                v-bind="{ editorType: 'TEXTBOX', }"
                                type="text"
                                style=""
                                name="field_textbox1"
                                :isDebounce="true"
                                :disabled="store.layoutModelDetails.field_textbox1?.disabled ? true : false"
                                :value="store.layoutData.field_textbox1"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            />
                            </slot>
                        </AppPanelField>
                        </slot>
                    </template>
                    <template #static_text3>
                        <slot name="static_text3" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_text3"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                    <template #field_textbox2>
                        <slot name="field_textbox2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPanelField
                            name="field_textbox2"
                            :value="store.layoutData.field_textbox2"
                            :layoutModelDetails="store.layoutModelDetails">
                            <slot name="field_textbox2Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppInput
                                v-bind="{ editorType: 'TEXTBOX', }"
                                type="text"
                                style=""
                                name="field_textbox2"
                                :isDebounce="true"
                                :disabled="store.layoutModelDetails.field_textbox2?.disabled ? true : false"
                                :value="store.layoutData.field_textbox2"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            />
                            </slot>
                        </AppPanelField>
                        </slot>
                    </template>
                    <template #static_text4>
                        <slot name="static_text4" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_text4"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                    <template #field_textbox3>
                        <slot name="field_textbox3" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPanelField
                            name="field_textbox3"
                            :value="store.layoutData.field_textbox3"
                            :layoutModelDetails="store.layoutModelDetails">
                            <slot name="field_textbox3Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppInput
                                v-bind="{ editorType: 'TEXTBOX', }"
                                type="text"
                                style=""
                                name="field_textbox3"
                                :isDebounce="true"
                                :disabled="store.layoutModelDetails.field_textbox3?.disabled ? true : false"
                                :value="store.layoutData.field_textbox3"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            />
                            </slot>
                        </AppPanelField>
                        </slot>
                    </template>
                </AppStandardContainer>
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
    </div>
</slot>
</template>
<script lang="ts" setup>
// 基于template/src/views/{{appModules}}/{{pages@DECUSTOMVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import { useProps, useBasic, useAction, useController } from './ibizbook-usr-0313793703-custom-view-hook';
import { IEvent, CustomViewActionType, ICustomViewAbility, ICustomViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: CustomViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: ICustomViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: ICustomViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})
</script>
